<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">

    <title><%= content_for?(:title) ? yield(:title) : "云链后台管理系统" %></title>
    <%= csrf_meta_tags %>

    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
      <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script>
    <![endif]-->

    <%= stylesheet_link_tag "admin", :media => "all" %>

    <!-- Preload js lib for hightcharts! Don't move to button! -->
    <%= javascript_include_tag "before_application" %>

    <!-- For third-generation iPad with high-resolution Retina display: -->
    <!-- Size should be 144 x 144 pixels -->
    <%= favicon_link_tag 'images/apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>

    <!-- For iPhone with high-resolution Retina display: -->
    <!-- Size should be 114 x 114 pixels -->
    <%= favicon_link_tag 'images/apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %>

    <!-- For first- and second-generation iPad: -->
    <!-- Size should be 72 x 72 pixels -->
    <%= favicon_link_tag 'images/apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %>

    <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
    <!-- Size should be 57 x 57 pixels -->
    <%= favicon_link_tag 'images/apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %>

    <!-- For all other devices -->
    <!-- Size should be 32 x 32 pixels -->
    <%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %>

  </head>
  <body class="">
  <!-- possible classes: minified, fixed-ribbon, fixed-header, fixed-width-->

  <header id="header">
      <div id="logo-group">

        <!-- PLACE YOUR LOGO HERE -->
        <span id="logo"> 
          <%= image_tag("logo.png") %> 
          <%= link_to APP_VERSION, admin_versions_path, :class => "version" %>
        </span>
        <!-- END LOGO PLACEHOLDER -->

      </div>     

      <div class="pull-left" id="global_menu">
       <%= tabs_tag builder: MenuTabBuilder, :open_tabs => { :class => "nav navbar-nav global_menu" } do |tab| %>
        <%= tab.terminals '设备', admin_terminal_groups_path if current_admin.can?(controller: "admin/terminal_groups") %> 
        <%= tab.business '业务', admin_account_groups_path if current_admin.can?(controller: "admin/account_groups") %>
        <% if current_admin.can?(controller: "admin/account_signins") || current_admin.can?(controller: "admin/downloads") || current_admin.can?(controller: "admin/traffics") || current_admin.can?(controller: "admin/app_connections") || current_admin.can?(controller: "admin/watchings") || current_admin.can?(controller: "admin/message_warnnings") || current_admin.can?(controller: "admin/recommands") %>
          <%= tab.statistics '统计', admin_account_signins_path %>
        <% end %>
        <%= tab.reports '报表', admin_report_groups_path if current_admin.can?(controller: "admin/report_groups") %>
        <li class="dropdown">
          <span href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="glyphicon glyphicon-list"></i> <span> 其它 </span> <i class="fa fa-angle-down"></i> </span>
          <ul class="dropdown-menu">
            <% if current_admin.can?(controller: "admin/programs") || current_admin.can?(controller: "admin/televisions") || current_admin.can?(controller: "admin/city_channels") %>
              <%= tab.programs '电台节目', admin_programs_path %>
            <% end %>
            <%= tab.release '发布管理', admin_app_versions_path if current_admin.can?(controller: "admin/app_versions") %>           

            <% if current_admin.can?(controller: "admin/api_visit_logs") || current_admin.can?(controller: "client_logs") || current_admin.can?(controller: "admin/tables") || current_admin.can?(controller: "admin/versions") || current_admin.can?(controller: "admin/activities") %>
              <%= tab.developers '日志管理', admin_activities_path %>
            <% end %>
            <% if current_admin.god? %>
              <%= tab.permissions '权限管理', admin_admins_path %>
            <% end %>
          </ul>
        </li>

        <% end %>
      </div>

      <!-- pulled right: nav area -->
      <div class="pull-right">

        <!-- collapse menu button -->
        <div id="hide-menu" class="btn-header pull-right">
          <span> <a href="javascript:void(0);" title="Collapse Menu"><i class="fa fa-reorder"></i></a> </span>
        </div>
        <!-- end collapse menu -->

        <!-- logout button -->
        <div id="logout" class="btn-header transparent pull-right">
          <ul class="nav navbar-nav">
            <li class="dropdown">
              <a class="dropdown-toggle" role="button" data-toggle="dropdown" href="#">
              <i class="glyphicon glyphicon-user"></i> <%= current_admin.email %> </span></a>
              <ul id="g-account-menu" class="dropdown-menu" role="menu">
                <li> <%= link_to "密码修改", edit_password_admin_admin_path(current_admin), remote: true %></li>
                <li> <%= link_to %{<i class="fa fa-sign-out"> 安全退出 </i> }.html_safe, destroy_admin_session_path, :method => :delete %> </li>
              </ul>
            </li>
          </ul>
        </div>
        <!-- end logout button -->

        <!-- search mobile button (this is hidden till mobile view port) -->
        <div id="search-mobile" class="btn-header transparent pull-right">
          <span> <a href="javascript:void(0)" title="Search"><i class="fa fa-search"></i></a> </span>
        </div>
        <!-- end search mobile button -->

        <!-- input: search field 
        <form action="admin/search" class="header-search pull-right">
          <input type="text" placeholder="姓名/手机号/车牌/mac" id="search-fld">
          <button type="submit">
            <i class="fa fa-search"></i>
          </button>
          <a href="javascript:void(0);" id="cancel-search-js" title="Cancel Search"><i class="fa fa-times"></i></a>
        </form>
         end input: search field -->

        <!-- multiple lang dropdown : find all flags in the image folder -->
        <ul class="header-dropdown-list hidden-xs">
          <li>
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <%= image_tag "img/flags/cn.png" %> <span> Chinese </span> <i class="fa fa-angle-down"></i></a>
            <ul class="dropdown-menu pull-right">
              <li class="active">
                <a href="javascript:void(0);"><%= image_tag "img/flags/cn.png" %> Chinese </a>
              </li>
            </ul>
          </li>
        </ul>
        <!-- end multiple lang -->

      </div>
      <!-- end pulled right: nav area -->

    </header>
    <!-- END HEADER -->

    <!-- Left panel : Navigation area -->
    <!-- Note: This width of the aside area can be adjusted through LESS variables -->
    <% if @left_panel.present? %>
    <aside id="left-panel"> 

      <%= render partial: @left_panel %>
      <!-- NAVIGATION -->
      
      <span class="minifyme">
        <i class="fa fa-arrow-circle-left hit"></i>
      </span>
    </aside>
    <% end %>
    <!-- END NAVIGATION -->

    <!-- MAIN PANEL -->
    <div id="main" role="main">
      <!-- RIBBON -->
      <% if @ways.present? %>
      <div id="ribbon">
        <!--
        <span class="ribbon-button-alignment"> <span id="refresh" class="btn btn-ribbon" data-title="refresh"  rel="tooltip" data-placement="bottom" data-html="true"><i class="fa fa-refresh"></i></span> </span>
        -->
        <!-- breadcrumb -->
        <ol class="breadcrumb">
          <%= @ways.map{|item| "<li>#{item}</li>" }.join.html_safe %>
        </ol>
        <!-- end breadcrumb -->

        <!-- You can also add more buttons to the
        ribbon for further usability

        Example below:

        <span class="ribbon-button-alignment pull-right">
        <span id="search" class="btn btn-ribbon hidden-xs" data-title="search"><i class="fa-grid"></i> Change Grid</span>
        <span id="add" class="btn btn-ribbon hidden-xs" data-title="add"><i class="fa-plus"></i> Add</span>
        <span id="search" class="btn btn-ribbon" data-title="search"><i class="fa-search"></i> <span class="hidden-mobile">Search</span></span>
        </span> -->

      </div>
      <% end %>
      <!-- END RIBBON -->   
 
        <!-- MAIN CONTENT -->
        <div id="content">
          <%= content_for?(:content) ? yield(:content) : yield %>
        </div>
        <!-- END MAIN CONTENT -->
 
    </div>
    <!-- END MAIN PANEL -->
    <%= javascript_include_tag "plugin/pace/pace.min.js", { "data-pace-options" => %{{ "restartOnRequestAfter": true }} } %>
    <%= javascript_include_tag "application" %>
    <!-- Don't move app.js to top! -->
    <%#= javascript_include_tag "demo" %>
    <%= javascript_include_tag "app" %>
    <%= javascript_include_tag "my" %>
    <%= content_for?(:js) ? yield(:js) : yield %>

  </body>
</html>